package com.ssy.wireless.web.vo.req;

import org.springframework.util.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by cofey on 16/11/20.
 */
public class EntQueryVo {
    private String area;
    private Integer type;
    private String name;
    private String createBeginTime;
    private String createEndTime;

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCreateBeginTime() {
        return createBeginTime;
    }

    public void setCreateBeginTime(String createBeginTime) {
        this.createBeginTime = createBeginTime;
    }

    public String getCreateEndTime() {
        return createEndTime;
    }

    public void setCreateEndTime(String createEndTime) {
        this.createEndTime = createEndTime;
    }

    public Map<String, Object> queryParams() {
        Map<String, Object> params = new HashMap();
        params.put("name", StringUtils.hasLength(this.getName()) ? "%" + this.getName() + "%" : null);
        params.put("type", this.getType());
        params.put("area", StringUtils.hasLength(this.getArea()) ? "%" + this.getArea() + "%" : null);
        params.put("createBeginTime", StringUtils.hasLength(this.getCreateBeginTime()) ? this.getCreateBeginTime() + " 00:00:00" : null);
        params.put("createEndTime", StringUtils.hasLength(this.getCreateEndTime()) ? this.getCreateEndTime() + " 23:59:59" : null);
        return params;
    }
}
